Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throw on non-ok server responses #155

Merged
merged 1 commit into from
Aug 21, 2023
Merged

Throw on non-ok server responses #155

merged 1 commit into from
Aug 21, 2023

Conversation

slifty
Copy link
Contributor

@slifty slifty commented Aug 21, 2023

This PR updates the SDK to throw an error in the event of a non-OK http response from the server. This also results in updated signatures for the delete methods, which used to return true / false depending on the outcome of a call.

Resolves #59
Resolves #89

@codecov
Copy link

codecov bot commented Aug 21, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (4a7f24e) 100.00% compared to head (a51400b) 100.00%.

❗ Current head a51400b differs from pull request most recent head f130b8f. Consider uploading reports for the commit f130b8f to get more accurate results

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #155   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           53        54    +1     
  Lines          354       356    +2     
  Branches        24        23    -1     
=========================================
+ Hits           354       356    +2     
Files Changed Coverage Δ
src/api/deleteFolderVo.ts 100.00% <100.00%> (ø)
src/api/deleteRecordVo.ts 100.00% <100.00%> (ø)
src/errors/HttpResponseError.ts 100.00% <100.00%> (ø)
src/errors/index.ts 100.00% <100.00%> (ø)
src/sdk/deleteArchiveRecord.ts 100.00% <100.00%> (ø)
src/sdk/deleteFolder.ts 100.00% <100.00%> (ø)
src/utils/makePermanentApiCall.ts 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@slifty slifty requested a review from meisekimiu August 21, 2023 17:42
When the server responds with a non-ok status we want to communicate
that response to the calling code base via a thrown error.  Prior to
this commit server errors would often be completely ignored and could
result in odd validation errors instead of communicating the actual
issue.

As part of this change our delete functions now *throw* when something
goes wrong, and so the type signature has been updated to no longer
return `boolean` to indicate success but rather a `void`.

Issue #59 Handle server errors explicitly
Issue #89 Evalauate return types for operation methods
@slifty slifty merged commit 38288f3 into main Aug 21, 2023
3 checks passed
@slifty slifty deleted the 89-update-return-types branch August 21, 2023 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Evalauate return types for operation methods Handle server errors explicitly
2 participants